<script setup lang="ts" >
import {
    Menu as IconMenu,
    House,
    Aim,
    MessageBox,
    Message,
    Edit,
    Pointer,
    View,
    Tools,
    ArrowDown,
    FullScreen
} from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const 	goLogin =()=>{
    router.push('/login')
}
</script>

<template>
    <div class="common-layout">
        <el-container>
            <el-aside width="200px">
                <el-menu class="el-menu-vertical-demo" router>
                    <div class="title">公司后台管理系统</div>
                    <el-menu-item index="home">
                        <el-icon>
                            <House />
                        </el-icon>
                        <span>首页</span>
                    </el-menu-item>
                    <el-menu-item index="2">
                        <el-icon><icon-menu /></el-icon>
                        <span>系统概览</span>
                    </el-menu-item>
                    <!-- 用户管理 -->
                    <el-sub-menu index="3">
                        <template #title>
                            <el-icon>
                                <Aim />
                            </el-icon>
                            <span>用户管理</span>
                        </template>
                        <!-- 组 -->
                        <el-menu-item-group title="管理员管理">
                            <el-menu-item index="1-1">产品管理员</el-menu-item>
                            <el-menu-item index="1-2">用户管理员</el-menu-item>
                            <el-menu-item index="1-3">消息管理员</el-menu-item>
                        </el-menu-item-group>
                        <el-menu-item-group title="用户管理">
                            <el-menu-item index="2-1">用户列表</el-menu-item>
                        </el-menu-item-group>
                    </el-sub-menu>
                    <!--  -->
                    <!-- 产品管理 -->
                    <el-sub-menu index="4">
                        <template #title>
                            <el-icon>
                                <MessageBox />
                            </el-icon>
                            <span>产品管理</span>
                        </template>
                        <el-menu-item-group title="管理员管理">
                            <el-menu-item index="3-1">产品管理员</el-menu-item>

                        </el-menu-item-group>
                        <el-menu-item-group title="用户管理">
                            <el-menu-item index="3-2">用户列表</el-menu-item>
                        </el-menu-item-group>

                    </el-sub-menu>
                    <!-- 消息管理 -->
                    <el-sub-menu index="5">
                        <template #title>
                            <el-icon>
                                <Message />
                            </el-icon>
                            <span>消息管理</span>
                        </template>
                        <el-menu-item-group title="消息管理">
                            <el-menu-item index="5-1">消息列表</el-menu-item>
                        </el-menu-item-group>
                        <el-menu-item-group title="回收站">
                            <el-menu-item index="5-2">回收站</el-menu-item>
                        </el-menu-item-group>

                    </el-sub-menu>
                    <el-menu-item index="6">
                        <el-icon>
                            <Edit />
                        </el-icon>
                        <span>合同管理</span>
                    </el-menu-item>
                    <el-menu-item index="7">
                        <el-icon>
                            <Pointer />
                        </el-icon>
                        <span>操作日志</span>
                    </el-menu-item>
                    <el-menu-item index="8">
                        <el-icon>
                            <View />
                        </el-icon>
                        <span>登录日志</span>
                    </el-menu-item>
                    <el-menu-item index="9">
                        <el-icon>
                            <Tools />
                        </el-icon>
                        <span>系统设置</span>
                    </el-menu-item>

                </el-menu>

            </el-aside>
            <el-container>
                <el-header>
                    <span class="header_left">欢迎登录此系统</span>

                    <div class="header_right">
                        <!-- 全屏 -->
                        <div class="screen"><el-icon>
                                <FullScreen />
                            </el-icon></div>
                        <!-- 消息 -->
                        <el-icon>
                            <Message />
                        </el-icon>
                        <!-- 头像 -->
                        <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
                        <!-- 下拉 -->
                        <el-dropdown>
                            <span class="el-dropdown-link" style="color: aliceblue;">
                                设置
                                <el-icon class="el-icon--right">
                                    <arrow-down />
                                </el-icon>
                            </span>
                            <template #dropdown>
                                <el-dropdown-menu>
                                    <el-dropdown-item>设置账号</el-dropdown-item>
                                    <el-dropdown-item divided>更改头像</el-dropdown-item>
                                    <el-dropdown-item divided @click="goLogin">退出登录</el-dropdown-item>
                                </el-dropdown-menu>
                            </template>
                        </el-dropdown>
                    </div>
                </el-header>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<style scoped lang="scss">
.el-aside {
    height: 100vh;
    background-color: #2b303b;
    width: 210px;

    // 隐藏滚动条
    overflow-x: hidden;

    .el-menu {
        background-color: #2b303b;
        width: 210px;
        height: 100px;


    }

    .title {
        color: white;
        padding: 20px;
        display: flex;
        justify-content: center;
    }

    .el-menu-item:hover {
        background-color: #020d19;
    }

    .el-menu-item {
        color: white;
    }

    :deep(.el-sub-menu__title) {
        color: white;
    }

    :deep(.el-sub-menu__title:hover) {
        background-color: #021122;
    }

    :deep(.el-menu--inline) {
        background: linear-gradient(60deg, #29323c 0%, #485563 100%);
    }
}

.el-header {
    background: linear-gradient(173deg, #021122 0%,#485563 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    height: 53px;

    .header_left {
        font-family: 'Courier New', Courier, monospace;
        font-size: 18px;

    }

    .header_right {
        display: flex;
        align-items: center;
        justify-content: space-around;
        // 左侧占比
        width: 15%;
    }
}</style>